<template>
	<view>
<!-- 		<navigator url="/pages/users/login">点击查看巡检指南，快速了解巡检要求-></navigator> -->
		<view class="content">
		<view class="count-today-card">
			<view class="title">今日统计</view>
			<view class="card-body">
				<view class="taskNum">
					<view class="taskNum-title">待巡检数</view>
					<view class="taskNum-num">{{this.dayInspection.inspectionNum}}</view>
				</view>
				<view class="taskNum">
					<view class="taskNum-title">异常次数</view>
					<view class="taskNum-num">{{this.dayInspection.exceptionNum}}</view>
				</view>
				<view class="taskNum">
					<view class="taskNum-title">漏检次数</view>
					<view class="taskNum-num">{{this.dayInspection.missNum}}</view>
				</view>
				<view class="taskNum">
					<view class="taskNum-title">不合格数</view>
					<view class="taskNum-num">{{this.dayInspection.failureNum}}</view>
				</view>
			</view>
		</view>
		<view class="count-record">
<!-- 			<helpButton name="今日未巡检">
				<view class="count-record-num" style="font-size: 30px;">{{this.dayUninspected}}</view>
			</helpButton> -->
			<helpButton name="本周未巡检">
				<view class="count-record-num" style="font-size: 30px;">{{this.weekUninspected}}</view>
			</helpButton>
			<helpButton name="本月未巡检">
				<view class="count-record-num" style="font-size: 30px;">{{this.monthUninspected}}</view>
			</helpButton>
<!-- 			<helpButton name="本季未巡检">
				<view class="count-record-num" style="font-size: 30px;">{{this.seasonUninspected}}</view>
			</helpButton> -->
			<helpButton name="本年未巡检">
				<view class="count-record-num" style="font-size: 30px;">{{this.yearUninspected}}</view>
			</helpButton>
		</view>
		<!-- <view class="total-task">
			<view class="total-title">总计：</view>
			<view class="msg">
				<view class="msg-tip">计划巡查数:</view>
				<view class="msg-content">1</view>
			</view>
			<view class="msg">
				<view class="msg-tip">完成巡查数:</view>
				<view class="msg-content">1</view>
			</view>
			<view class="msg">
				<view class="msg-tip">漏检次数:</view>
				<view class="msg-content">1</view>
			</view>
			<view class="msg">
				<view class="msg-tip">漏检率:</view>
				<view class="msg-content">1</view>
			</view>
			<view class="msg">
				<view class="msg-tip">不合格数:</view>
				<view class="msg-content">1</view>
			</view>
			<view class="msg">
				<view class="msg-tip">不合格率:</view>
				<view class="msg-content">1</view>
			</view>
		</view> -->
		</view>
	</view>
</template>

<script>
	import request  from '../../common/request'
	export default {
		data() {
			return {
				dayUninspected:0,
				weekUninspected:0,
				monthUninspected:0,
				seasonUninspected:0,
				yearUninspected:0,
				userId : 0,
				dayInspection:{
					inspectionNum:0,
					exceptionNum:0,
					missNum:0,
					failureNum:0
				}
			}
		},
		onLoad() {
			uni.setTabBarItem({
				index: 0,
				visible: true
			})
			uni.setTabBarItem({
				index: 1,
				visible: true
			})
			uni.setTabBarItem({
				index: 2,
				visible: false
			})
			uni.setTabBarItem({
				index: 3,
				visible: false
			})
			let userInfo = uni.getStorageSync('userInfo')
			this.userId = userInfo.userId
			
		},
		onShow() {
			this.getStatusNum()
			this.getnonInspection()
		},
		methods: {
			getStatusNum(){
				request('/inspection/statusNum','GET',{},{
					userId : this.userId
				}).then(res=>{
					console.log(res)
					this.dayInspection = res.data.data
				})
			},
			getnonInspection(){
				request('/inspection/nonInspection','GET',{},{
					userId : this.userId
				}).then(res=>{
					console.log(res)
					this.weekUninspected = res.data.data.weekNonInspection
					this.monthUninspected = res.data.data.monthNonInspection
					this.yearUninspected = res.data.data.yearNonInspection
				})
			}
		}
	}
</script>

<style scoped>
	.content{
		width: 100%;
		display: flex;
		flex-direction: column;
		align-items: center;
	}
.count-today-card{
	width: 90%;
	margin: 15px;
	background-color: #fff;
}
.title{
	background-color: #007AFA;
	height: 40px;
	display: flex;
	align-items: center;
	padding-left: 10px;
	color: white;
}
.card-body{
	display: flex;
	flex-wrap: wrap;
}
.taskNum{
	width: 50%;
	height: 130px;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.taskNum-title{
	margin-top: 20px;
}
.taskNum-num{
	font-size: 35px;
	height: 100px;
	padding-top: 15px;
	align-self: center;
	justify-self: center;
}
.count-record{
	padding: 10px;
	display: flex;
	width: 80%;
	flex-wrap: wrap;
}
.total-task{
	width: 80%;
	background-color: #fff;
	padding: 10px;
}
.total-title{
	font-size: 25px;
}
.msg{
	display: flex;
}
</style>